/*
 * Copyright (C) 2008-2011 CBDP Consortium
 * 
 * All rights reserved.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.
 * 
 * This software consists of contributions made by many individuals, 
 * listed below:
 *
 * Author: 	Xabier Laiseca <xabier.laiseca@deusto.es>
 * 			David Ausín <david.ausin@deusto.es>
 */
package cbdp.server.contextreasoner.impl.util;

public class DebugUtils
{
	private final static String CBDP_DEBUG_KEY = "cbdp.contextreasoner.debug";
	private final static String CONTEXT_REASONER_DEBUG_KEY = "cbdp.contextreasoner.debug";
	
	private final static boolean inDebugMode;
	
	static
	{
		inDebugMode = System.getProperty(CBDP_DEBUG_KEY, "false").equals("true") 
						|| System.getProperty(CONTEXT_REASONER_DEBUG_KEY, "false").equals("true");
	}
	
	
	
	public static void printIfInDebugModel(final String text)
	{
		if (inDebugMode)
		{
			print(text);
		}
	}
	
	public static void printlnIfInDebugModel()
	{
		if (inDebugMode)
		{
			println();
		}
	}
	
	public static void printlnIfInDebugModel(final String text)
	{
		if (inDebugMode)
		{
			println(text);
		}
	}
	
	public static boolean isInDebugMode()
	{
		return inDebugMode;
	}
	
	public static void print(final String text)
	{
		System.out.print(text);
	}
	
	public static void println()
	{
		System.out.println();
	}
	
	public static void println(final String text)
	{
		System.out.println(text);
	}
}
